<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<%@include file="/common/repairAddress.jsp" %>
<!DOCTYPE html>
<html>
<head>
<title>大中修项目--${fns:getConfig('productName')}</title>
<%@include file="/common/uihead.jsp" %>
<%@include file="/common/upload.jsp" %>
<script src="${ctxStatic}/js/public/public.js" type="text/javascript"></script>
<style type="text/css">
textarea{
height:55px !important;
}
</style>
</head>
<body>
	<ul class="nav nav-tabs" style="margin:0 4px 4px 4px;">
		<c:forEach items="${list}" var="menu"  varStatus="idxStatus">
			<li class="${menu.tag eq tag?'active':''}">
				<a href="${ctx}/${menu.href}${fn:indexOf(menuChild.href, '?') eq -1?'?':'&'}left=${fns:encodeParamUrl(left)}&top=${fns:encodeParamUrl(top)}&parentId=${fns:encodeParamUrl(parentId)}&LId=${fns:encodeParamUrl(LId)}&filter_EQS_tag=${menu.tag}">
					<i class="icon icon-list" style="margin-right:10px"></i><span>${menu.name}</span>
				</a>
			</li>
		</c:forEach>
	</ul>
    <tags:message content="${msg}" />
<form id="mainForm" class="form-horizontal" role="form" method="get"  name="mainForm">
<div class="breadcrumb form-search" style="background-color: #f5f5f5;">
			<div>
				<label>关键字:</label>
				<input type="text" oninput="queryForGrid('mainForm','jqGrid')" onporpertychange="queryForGrid('mainForm','jqGrid')"  name="filter_LIKES_projectName_OR_projectNumber_OR_roadName_OR_signOrg_OR_roadCode" value="${filter_LIKES_projectName_OR_projectNumber_OR_roadName_OR_signOrg_OR_roadCode}" placeholder="大中修项目查询" />
				<sec:authorize ifAnyGranted="ROLE_dzx_gcglzd_editor" >
				<a href="#javascript:void(0)" onclick= "openPublicModal();"  class="btn btn-primary" role="button" >新增&nbsp;</a>
				</sec:authorize>
			</div>
		</div>
  <table id="jqGrid"></table>
  <div id="jqGridPager"></div> 
</form>
<form id="publicForm" name="publicForm">
   <input type="hidden" name="token" value="${token}" id="token">
   <input type="hidden" name="id" id="id" value="">
   <input type="hidden" name="tag" id="tag" value="${tag}">
<div class="modal fade" id="publicModal" tabindex="-1" role="dialog" aria-labelledby="publicModal" aria-hidden="true" data-backdrop="static" style="width:1300px;max-height:700px">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="myModalLabel">新增/修改</h4>
					</div>
					<div class="modal-body">
						<table class="table"  style="border: none;margin-bottom: -14px">
							<tbody>
								<tr>
									<td colspan="6">
										<h4 style="font-weight:bolder">基本信息：</h4>
										<hr>
									</td>
								</tr>
								<tr>
									<td>项目编号<font color="red">&nbsp;*</font>:</td>
									<td style="width:310px">
										<input name="projectNumber" id="projectNumber" maxlength="50" type='text' value="" class="required">
									</td>
									<td > 项目名称<font color="red">&nbsp;*</font>:</td>
									<td style="width:310px">
										<input name="projectName" id="projectName" maxlength="125" type='text' value="" class="required">
									</td>
									<td>项目性质<font color="red">&nbsp;*</font>:</td>
									<td style="width:310px">
										<pt:code name="buildKind" category="3008" hasEmpty="false" default=""></pt:code>
									</td>
								</tr>
								<tr>
									<td id="eunits"> 项目年度<font color="red">&nbsp;*</font>:</td>
									<td >
										<input  id="projectYear" name="projectYear" value="" 
										onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy'})" class="Wdate required" type="text">
									</td>
									<td>项目概括:</td>
									<td colspan="3">
										<div class="wordCount wyInline" id="projectPoint_wordCount">
											<textarea placeholder="文件内容描述" rows='3' id="projectPoint"
												name="projectPoint"></textarea>
											<span class="wordwrap"><var class="word">1024</var>/1024</span>
										</div>
									</td>
								</tr>
								<tr>
									<td id="eunits"> 工程位置<font color="red">&nbsp;*</font>:</td>
									<td >
										<input name="projectLocation" id="projectLocation" maxlength="512" type='text' value="" class="required">
									</td>
									<td> 维修措施<font color="red">&nbsp;*</font>:</td>
									<td colspan="3">
										<div class="wordCount wyInline" id="projectService_wordCount">
											<textarea placeholder="维修措施内容描述" rows='3' id="projectService"
												name="projectService"></textarea>
											<span class="wordwrap"><var class="word">1024</var>/1024</span>
										</div>
									</td>
								</tr>
								<tr>
									<td id="eunits"> 项目区域<font color="red">&nbsp;*</font>:</td>
									<td >
										<pt:code name="district" category="2050" hasEmpty="false" default=""></pt:code>
									</td>
									<td>街　　道:</td>
									<td>
										<input name="subDistrict" id="subDistrict" maxlength="25" type='text' value="">
									</td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<td colspan="6">
										<h4 style="font-weight:bolder">项目投资：</h4>
										<hr>
									</td>
								</tr>
								<tr>
									<td id="eunits"> 建设单位<font color="red">&nbsp;*</font>:</td>
									<td >
										<input name="signOrg" id="signOrg" maxlength="50" type='text' value="" class="required">
									</td>
									<td > 项目负责人<font color="red">&nbsp;*</font>:</td>
									<td>
										<input name="principal" id="principal" maxlength="50" type='text' value="" class="required">
									</td>
									<td > 资金来源<font color="red">&nbsp;*</font>:</td>
									<td>
										<pt:code name="maintainSource" category="2002" hasEmpty="false" default=""></pt:code>
									</td>
								</tr>
								<tr>
									<td id="eunits"> 计划总投资:</td>
									<td >
										<input name="projectCost" id="projectCost" maxlength="18" type='text' value="" >
									</td>
									<td > 实际投资:</td>
									<td>
										<input name="projectApplyCost" id="projectApplyCost" maxlength="18" type='text' value="" >
									</td>
									<td > </td>
									<td>
									</td>
								</tr>
								<tr>
									<td colspan="6">
										<h4 style="font-weight:bolder">项目实施：</h4>
										<hr>
									</td>
								</tr>
								<tr>
									<td id="eunits"> 施工单位<font color="red">&nbsp;*</font>:</td>
									<td >
										<input name="mainOrg" id="mainOrg" maxlength="50" type='text' value="" class="required">
									</td>
									<td > 设计单位<font color="red">&nbsp;*</font>:</td>
									<td>
										<input name="designOrg" id="designOrg" maxlength="50" type='text' value="" class="required">
									</td>
									<td > 监理单位<font color="red">&nbsp;*</font>:</td>
									<td>
										<input name="supOrg" id="supOrg" maxlength="50" type='text' value="" class="required">
									</td>
								</tr>
								<tr>
									<td id="eunits"> 计划开始时间:</td>
									<td >
										<input  id="planBeginDate" name="planBeginDate" value="" 
										onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'planEndDate\')}'})" class="Wdate" type="text">
									</td>
									<td > 计划结束时间:</td>
									<td>
										<input  id="planEndDate" name="planEndDate" value="" 
										onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'planBeginDate\')}'})" class="Wdate" type="text">
									</td>
									<td > 实际开始时间:</td>
									<td>
										<input  id="beginDate" name="beginDate" value="" 
										onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'endDate\')}'})" class="Wdate" type="text">
									</td>
								</tr>
								<tr>
									<td id="eunits"> 实际结束时间:</td>
									<td >
										<input  id="endDate" name="endDate" value="" 
										onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'beginDate\')}'})" class="Wdate" type="text">
									</td>
									<td > 备注<font color="red">&nbsp;*</font>:</td>
									<td colspan="3">
										<div class="wordCount wyInline" id="wordCount">
											<textarea placeholder="备注内容" rows='3' id="remark"
												name="remark"></textarea>
											<span class="wordwrap"><var class="word">200</var>/200</span>
										</div>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div class="modal-footer" style="padding:4px 15px 5px;">
						<button type="button" class="btn btn-default" data-dismiss="close">关闭</button>
						<button type="button" class="btn btn-danger" onclick='publicDel("${ctx}/mainTenance/delete.do");' style="display:none;" id="delPublic">删除</button>
						<button type="submit" class="btn btn-primary" id="subPublic" >提交</button>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal -->
		</div>
</form>
	<script type="text/javascript">
	    var path = "${ctx}";
	    var tag = "${tag}";
		$(document).ready(function()
		{
			var jqgridH = $(window).height()-345;       
			$("#publicForm").validate({
				debug:true,
				rules: {
					 projectCost:{
	                     number:true,
	                     maxlength:12,
	                     min:0,
	                     max:9999999
	                 },
	                 projectApplyCost:{
	                     number:true,
	                     maxlength:12,
	                     min:0,
	                     max:9999999
	                 }
				},
				messages: {
					
				},
				submitHandler:function(form){
						$('#subPublic').attr('disabled','disabled');  //防止重复提交，请求完毕之前禁用提交按钮
						var url ="${ctx}/mainTenance/save.do";
						publicSubmit(url);
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
			$("#jqGrid").jqGrid(
			{ url : '${ctx}/mainTenance/list.do',
			  mtype : "GET",
			  datatype : "json",
			  page : 1,
			  viewrecords: true,
			  colModel:[<sec:authorize ifAnyGranted="ROLE_dzx_gcglzd_editor" >
				{ label : "操作", name : "id", 
					  width : 100,   align : 'center', sortable : false, search : false ,
					  classes:'ui-jqgrid-optClass',
					  formatter: function (cellValue, options, rowObject){
							return formatterOpt(cellValue);
					  }
				},</sec:authorize>
				{ label : "文件", name : "id", 
					  width : 100,   align : 'center', sortable : false, search : false ,
					  classes:'ui-jqgrid-optClass',
					  formatter: function (cellValue, options, rowObject){
							return "<a href='javascript:void(0);' onclick='openModal(\"T_YH_MAINTENANCE\",\"" + cellValue+"\",\"" + rowObject['projectName']+"\");' role='button' >"+
							"<i class='icon-upload' style='margin-top:4px'></i>&nbsp;上传附件</a>";
					  }
				},{
	            	 label: "项目名称",
	            	 name: 'projectName',
	            	 align: 'center',
	            	 width: 230
	             },{
	               	 label: "项目编号",
	            	 name: 'projectNumber',
	            	 align: 'center',
	            	 width: 110
	             },{
	            	 label: "项目概括",
	         	   	 name: 'projectPoint',
	         	   	 align: 'center',
	         	   	 width: 100
	             },{
	            	 label: "工程位置",
	            	 name: 'projectLocation',
	            	 align: 'center',
	         	   	 width: 200
	             },{
				     label:    '项目年度',
				     name: 'projectYear',
				     align : 'center',
				     width: 100
	             },{
				     label:    '维修措施',
				     name: 'projectService',
				     align : 'center',
				     width: 100
	             },{
				     label:    '建设单位',
				     name: 'signOrg',
				     align : 'center',
				     width: 100
	             },{
	            	 label: "施工单位",
	         	   	 name: 'mainOrg',
	         	   	 align: 'center',
	         	   	 width: 200
	             },{
				     label:    '设计单位',
				     name: 'designOrg',
				     align : 'center',
				     width: 200
	             },{
				     label:    '监理单位',
				     name: 'supOrg',
				     align : 'center',
				     width: 200
	             },{
	            	 label: "区",
	            	 name: 'district',
	            	 formatter: function (cellValue){
	                 	return Pengtu.buildCodeName(2050,cellValue);
					},
	            	 align : 'center',
	            	 width: 100
	             },{
	            	 label:    '街道',
	            	 name: 'subDistrict',
// 	            	 formatter: function (cellValue, options, rowObject){
// 	            		 return Pengtu.buildCodeName(rowObject.district, cellValue);
// 	            	 },
	            	 align : 'center',
	            	 width: 		100
	             },{
	            	 label:    '资金来源',
	            	 name: 'maintainSource',
	            	 formatter: function (cellValue){
	                    	return Pengtu.buildCodeName(2002,cellValue);
	             	},
	            	 align : 'center',
	            	 width: 		100
	             },{
					label:    '建设性质',
					name: 'buildKind',
					formatter: function (cellValue){
					return Pengtu.buildCodeName(3008,cellValue);
	            },
	            	align : 'center',
	            	width: 		100
	            },{
					label: '项目负责人',
					name: 'principal',
					align: 'center',
					width: 100
	             },{
	            	label: '项目计划总投资(万元)',
	            	name: 'projectCost',
	            	align: 'center',
	            	width: 150
	             },{
	            	label: '实际金额(万元)',
	            	name: 'projectApplyCost',
	            	align: 'center',
	            	width: 120
	             },{
	            	label: '计划开始时间',
	            	name: 'planBeginDate',
	            	align: 'center',
	            	width: 100
	             },{
	            	label: '计划结束时间',
	            	name: 'planEndDate',
	            	align: 'center',
	            	width: 100
	             },{
	            	label: '实际开始时间',
	            	name: 'beginDate',
	            	align: 'center',
	            	width: 100
	             },{
	            	label: '实际结束时间',
	            	name: 'endDate',
	            	align: 'center',
	            	width: 100
	             },{
	            	label:    '备注',
	            	name: 'remark',
	            	align:'center',
	            	width: 		100
	             }
						],
			autowidth : false,width:$(window).width()-248, height : jqgridH,scrollOffset:0, shrinkToFit : 400, rowNum : 10, viewrecords : true, rownumbers : true,
			jsonReader:{
    			root: "result",
    			page: "currentPage",
    			total: "totalPages",
    			records: "totalCount",
    			repeatitems: true,
    			cell: "cell",
    			id: "id",
    			userdata: "userdata",
    			subgrid: {root:"results", repeatitems: true, cell:"cell"}
    		},
    		prmNames: {
				page:"pageNo",
				rows:"pageSize",
				sort: "orderBy",
				order: "order",
				search:"_search",
				nd:"nd", id:"id",
				oper:"oper",
				editoper:"edit",
				addoper:"add",
				deloper:"del",
				subgridid:"id",
				npage: null,
				totalrows:"totalCounts"
			}, 
			rowList :[10,20,30], 
			pager : "#jqGridPager"
			});
		});
		
	function formatterOpt(id) {
		return "<a href='javascript:void(0);' onclick='updatePublic(\"" + id
				+ "\",\"${ctx}/mainTenance/show.do\");' id='" + id
				+ "'  title='修改'><i class='icon icon-edit' style='margin-top:4px;'></i>&nbsp;修改</a>";
	}
</script>
<jsp:include page="/WEB-INF/views/system/attachment.jsp"/> 
</body>
</html>